import React from 'react';
import ReactDOM from 'react-dom';
import {createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux'
import {
  BrowserRouter,
  Route,
  Link,
  Switch,
  Redirect
} from 'react-router-dom'
import reducer from './reducer.js'
import App from './App';
import Auth from './Auth.js';
import Dashboard from './Dashboard.js';
import './config'
import 'antd-mobile/dist/antd-mobile.css'

const reduxDevtools = window.devToolsExtension?window.devToolsExtension():f=>f

const store = createStore(reducer, compose(applyMiddleware(thunk),reduxDevtools))


// function render(){
   ReactDOM.render(
    (<Provider store={store}>
      <BrowserRouter>
        <div>
          <Switch>
            <Route path='/login' exact component={Auth}></Route>
            <Route path='/dashboard' component={Dashboard}></Route>
            <Redirect to='/dashboard'></Redirect>

          </Switch>
         </div>
      </BrowserRouter>
    </Provider>),
    document.getElementById('root')
  );
// }
// render()
// store.subscribe(render)

function scend(){
  return (
     <div>22222222222</div>
    )
}

function third(){
  return (
     <div>333333333333</div>
    )
}

// function Test(){
//   return (
//      <div>test*****test******test</div>
//     )
// }

class Test extends React.Component{
   constructor(props) {
     super(props);
    }

   render(){
      console.log(this.props)
      return <h2>test*****test******test</h2>
   }
}